﻿/*
#define  _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
int main() {
	char a, b, c;
	scanf("%c %c %c", &a, &b, &c);
	printf("%c\n %c\n %c\n", a, b, c);

	return 0;
}*/
/*
define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int i = 0;
	printf("请输入一个整数\n");
	scanf("%d\n", &i);
	if (i%2==0)
		printf("%d\n", i);
	
	return 0;}

*/

/*#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int x = 0;
	int y = 0;
	printf("请输入x的值\n");
	scanf("%d", &x);
	if (x >= 0) {
		printf("y=%d\n", 2*x+ 3);
	}
	else if (x < 0) {
		printf("y=%d\n", x * x * x - 5);
	}
	return 0;
	}
 */
/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(){
	int m;
	printf("请输入一个数\n");
	scanf("%d",&m);
	while (m>0)
	{
		printf("%d\n", m);
		m--;
	}
	return 0;
}
*/
//判断循环几次
/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i, x;
	scanf("%d %d", &i, &x);
	for (i = 0, x = 0; !x && i <= 5; i++);
	printf("%d", i);

	return 0;

}
*/
/*
#include <stdlib.h>
#include <time.h>

int main()
{
	srand(time(NULL));
	for (int i = 0; i < 10; i++)
	{
		int randValue = rand() % 10;
	}
}
*/



//猜数游戏
/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
srand(time(0));
int number = rand() % 100 + 1;
int count = 0;
int a = 0;
printf("我已经想好了一个1到100之间的数\n");
do {
	printf("猜猜这个1到100之间的数:\n");
	scanf("%d", &a);
	count++;
	if (a > number) {
		printf("你猜的数大了\n");
	}
	else if (a < number) {
		printf("你猜的数小了\n");
	}
} while (a != number);
printf("太好了，你用了%d次就猜到了答案\n",count);

return 0;
}
*/


/*
//奇偶个数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i = 0;
	int a = 0;
	int b = 0;
	printf("请输入一系列正整数\n");
	scanf("%d", &i);
	while (i > 0) {
		if (i % 2 == 1) {
			a++;
		}
		else if (i % 2 == 0) {
			b++;
		}
		scanf("%d", &i);
	}
		printf("%d %d\n", a, b);

	
	return 0;
	


}
*/

/*
//数字加密
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int i = 0;
printf("请输入一个四位数\n");
	scanf("%d", &i);

	int a = i % 10;
	int b = i/10%10;
	int c = i/100%10;
	int d = i/1000;
	int e = 0;
	int f = 0;
	int g = 0;
	int h = 0;
	
	e = (a  + 9) % 10;
	f = (b  + 9) % 10;
	g = (c  + 9) % 10;
	h = (d + 9) % 10;
	printf("您加密后的密码是%d\n", f * 1000 + e * 100 + h* 10 + g);

	return 0;
}
*/
/*
//错误
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i = 0;
	printf("请输入一个四位数\n");
	scanf("%d", &i);
	int a = i % 10;
	int b = i / 10 % 10;
	int c = i / 100 % 10;
	int d = i / 1000;
	int sum = 0;
	if (a % 2 == 0) {
		printf("sum = %d\n", a * a);
	}
	else if (b % 2 == 0) {
		printf("sum = %d\n", b * b);
	}
	else if (c % 2 == 0) {
		printf("sum = %d\n", c * c);
	}
	else if (d % 2 == 0) {
		printf("sum = %d\n", d * d);
	}
	else if (b % 2 == 0,a%2==0) {
		printf("sum=%d\n", a * a + b * b);
	}	
	else if (c % 2 == 0, a % 2 == 0, b % 2 == 0) {
		printf("sum=%d\n", a * a + b * b + c * c);
	}		
	else if (d % 2 == 0,c % 2 == 0,a%2==0,b%2==0) {
		printf("sum=%d\n", a * a + b * b + c * c + d * d);
	}
	else if (a % 2 == 0, c % 2 == 0) {
		printf("sum=%d\n", a * a + c * c);
	}
	else if (a % 2 == 0, b % 2 == 0, c % 2 == 0) {
		printf("sum=%d\n", a * a +b*b+ c * c);
	}
	else if (b % 2 == 0, c % 2 == 0) {
		printf("sum=%d\n",  b * b + c * c);
	}
	else if (b % 2 == 0, d % 2 == 0) {
		printf("sum=%d\n", b * b + d * d);
	}
	else if (a % 2 == 0, d % 2 == 0) {
		printf("sum=%d\n", a * a + d * d);
	}
	else if (b % 2 == 0,c%2==0, d % 2 == 0) {
		printf("sum=%d\n", b*b + c*c+d * d);
	}
	else if (d % 2 == 0, c % 2 == 0) {
		printf("sum=%d\n", d * d + c * c);
	}

			
	return 0;


}
*/

/*
//求各位数字为偶数的平方和
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {

	int n = 0;
    int sum=0;
	printf("请输入一个四位数\n");
	scanf("%d", &n);
	while (n) {
		int g = n % 10;
		if (g % 2 == 0) 
			sum += g * g;
			n /= 10;
			
}
	printf("%d\n", sum);
	
	return 0;
}
*/
/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int a = 0;
	printf("请输入您的彩票尾号\n");
	scanf("%d", &a);
	switch (a) {
	case 1:printf("中奖100元\n"); break;
	case 2:printf("中奖5000元\n"); break;
	case 3:printf("中奖100元\n"); break;
	case 4:printf("中奖5000元\n"); break;
	case 5:printf("中奖100元\n"); break;
	case 6:printf("中奖5000元\n"); break;
	case 7:printf("中奖500万元\n"); break;
	default:printf("没有中奖\n");
	}

		return 0;
}
*/
/*
//简易计算器
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
    char n=0;
	float a = 0;
	float b = 0;
	printf("请输入a,b的值\n");
	scanf("%f %c %f", &a,&n,&b);
	switch (n) {
	case '+':printf("a+b=%f\n", a + b); break;
	case '-':printf("a-b=%f\n", a - b); break;
	case '*':printf("a*b=%f\n", a * b); break;
	case '/':printf("a/b=%f\n", a / b); break;
	default:printf("input error\n");
	}

	return 0;
}
*/

/*
//三个数字比大小求max min
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	float num1 = 0;
	float num2 = 0;
	float num3 = 0;
	
	printf("请输入3个实数\n");
	scanf("%f %f %f", &num1, &num2, &num3);
	printf("平均值为%.2f", (num1 + num2 + num3) / 3);
	if (num1 > num2) {
		if (num1 > num3) {
			printf("最大值是%f\n", num1);
		}
		else {
			printf("最大值是%f\n", num3);
		}
	}
	else {
		if (num2 > num3) {
			printf("最大值是%f\n", num2);
		}
		else {
			printf("最大值是%f\n", num3);
		}
	}

	if (num1<num2) {
		if (num1< num3) {
			printf("最小值是%f\n", num1);
		}
		else {
			printf("最小值是%f\n", num3);
		}
	}
	else {
		if (num2< num3) {
			printf("最小值是%f\n", num2);
		}
		else {
			printf("最小值是%f\n", num3);
		}
	}




	return 0;

}
*/
/*
//求一个实数的整数部分与小数部分
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	
	double i = 0;
	int a = 0;
	double m = 0;
	printf("请输入一个实数\n");
	scanf("%lf", &i);
	a = i;
		m = i - a;
	printf("整数部分为%d,小数部分为%lf\n", a, m);

	return 0;
}
*/

/*
//整数倒序
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int n = 0;
	scanf("%d", &n);
	if (!n)
		printf("0");
	while (n) {
		printf("%d ", n % 10);
		n /= 10;
	}

	return 0;
}
*/

/*
//素数和
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int n, m;
	int i = 0;
	int cnt = 0;
	int sum = 0; 
	scanf("%d %d", &n, &m);
	if (n ==1)
		n = 2;
	for (i = n; i <= m; i++) {
		int k;
		int isPrime = 1;
		for (k = 2; k < i - 1; k++) {
			if (i % k == 0) {
				isPrime = 0;
				break;
			}
		}
		if (isPrime) {
			cnt++;
			sum += i;
		}
	}
	printf("%d %d\n", cnt, sum);


	return 0;
}
*/

/*
//念整数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int n = 0;
	printf("输入一个整数\n");
	scanf("%d",&n);
	if (n < 0) {
		n = -n;
		printf("fu ");
	}
	int m = 0;
	int a = n;
	while (a) {
		m = m * 10 + a % 10;
		a/= 10;
	}
	while (m) {

		switch (m%10) {
		case 1:printf("yi "); break;
		case 2:printf("er "); break;
		case 3:printf("san "); break;
		case 4:printf("si "); break;
		case 5:printf("wu "); break;
		case 6:printf("liu "); break;
		case 7:printf("qi "); break;
		case 8:printf("ba "); break;
		case 9:printf("jiu "); break;
		case 0:printf("ling "); break;
		default:break;
		}
		m /= 10;
	}

	return 0;
}
*/

/*
//1到100之间的偶数和
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i = 0;
	int sum = 0;
	for (i = 0; i <= 100; i += 2) {
		sum += i;
	}
//	while(i<=100){
//	i+=2;
//	sum+=i;
//	}
	printf("1到100之间的偶数和为%d\n", sum);

	return 0;
}
*/


/*
//n!
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	float n = 0;
	scanf("%d", &n);
	int s = 1;
	int m = 1;
	while (m <= n) {
		s *= m;
		m++;
	}
	printf("%f\n", s);

	return 0;
}
*/

/*
//1到100之间含8的整数和
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int n = 8;
	int sum1 = 0;
	while (n <= 98) {
		sum1+= n;
		n += 10;
	}

	int m = 80;
    int sum2 = 0;
	while (m <=89) {
	sum2 += m;
			m++;
	}
	printf("%d\n", sum1 + sum2-88);

	return 0;
}
*/
/*
//统计输入字符的个数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i = 0;
	printf("请输入字符\n");
	while (getchar() != '\n') {
		i++;
	}
	printf("%d", i);

	

	return 0;
}
*/
/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i=0;
    printf("请输入字符\n");
	for (; getchar() != '\n'; )i++;
		printf("%d\n", i);
		

	return 0;
}
*/
/*
//
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i = 0;
	int c = 0;
	printf("请输入字符\n");
	while ((c = getchar()) != '\n') {

		if (c >= '0' && c <= '9')
			continue;
		i++;
}
	printf("%d", i);

	return 0;
}
*/

/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int sum = 0;
	int i = 0;
	for (i = 1; i <= 100; i++) {
		sum += i;
		if (sum >= 55)break;
	}
	printf("i=%d,sum=%d", i, sum);

	return 0;
}
*/

/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	float sum = 0;
	int i = 0;
	int k = 0;
	sum = 0;
	k = 1;
	for (i = 1; i <= 100; i++) {
		sum = sum + k * (1.0 / i);
		k *= -1;
	}
	printf("%f", sum);

	return 0;
}
*/

/*
//判断素数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int m = 0;
	int i = 0;
	printf("请输入一个整数\n");
	scanf("%d", &m);
	for (i = 2; i < m; i++) {
		if (m % i == 0) {
			printf("%d不是素数", m);
			break;
		}
	}
	if (m == i) {
		printf("%d是素数", m);
	}
	else if (m == 1) {
		printf("%d不是素数", m);
	}

	return 0;
}
*/
/*
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int n;
	printf("请输入一个1-100之间的整数：\n");
	scanf("%d", &n);

	int m = 0;
	for (int i = 2; i < n; i++) {
		if (n % i == 0) {
			m++;
		}
	}
	if (m == 0) {
		printf("%d是素数\n", n);
	}
	else {
		printf("%d不是素数\n", n);
	}
	return 0;
}
*/
/*
//100内素数
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int i = 0;
	for (i = 2; i <= 100; i++) {
		int j = 0;
		for (j = 2; j < i; j++) {
			if (i % j == 0) {
				break;
			}        
		}
         if(j==i){
		    printf("%d ", i);      
    }

	}
	return 0;
}
*/
/*
//水仙花数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {

	for (int i = 100; i < 1000; i++) {

		int a, b, c;
		a = i % 10;
		b = i / 10 % 10;
		c = i / 100;
		if (a * a * a + b * b * b + c * c * c == i)
			printf("%d\n", i);

	}
	return 0;
}
*/
/*
//输入数字分析每个数字出现的次数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int x;
	int count[10];
	int i;

	for (i = 0; i < 10; i++) {
		count[i] = 0;
	}
	scanf("%d", &x);
	while (x != -1) {
		if (x >= 0 && x <= 9) {
			count[x]++;
		}
		scanf("%d", &x);
	}
	for (i = 0; i < 10; i++) {
		printf("%d:%d\n", i, count[i]);
	}

	return 0;
}
*/


/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	//int n = 0;
    int choice = 1;
	printf("请输入商品的编号\n");
    
	for(;choice!=0;){
	scanf("%d", &choice);
	switch (choice) {
	case 1:printf("爆米花的价格为5元\n"); break;
	case 2:printf("薯片的价格为3元\n"); break;
	case 3:printf("巧克力的价格为4元\n"); break;
	case 4:printf("可乐的价格为3元\n"); break;
	case 0: break;
	default:printf("价格为0\n"); break;
    }
	}

	return 0;
}
*/


/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	float score, max, min, ave = 0, sum = 0;
	int num = 0;
	char n = 0;

	do {

		printf("请输入学生的成绩\n");
		scanf("%f", &score);

		if (num == 0)
		{
			max = score;
			min = score;
		}

		num++;
		sum += score;
		if (score > max)
			max = score;
		if (score < min)
			min = score;
		printf("是否继续Y/N");
		scanf("\n%c", &n);//\n 吸收上一次输入的回车 %c接收字符
	} while (n == 'Y');

	ave = sum * 1.0 / num;
	printf("最高成绩为；%f\n最低成绩为；%f\n平均分为；%f", max, min, ave);

	return 0;
}
*/

/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i,num=0, max, min=0, sum=0, avg = 0;
	int a[10];
	printf("请输入10个数\n");
	for (i = 0; i < 10; i++) {
		scanf("%d", &a[i]);
		num++;
		sum += a[i];
	}
	
	max = a[0];
	min = a[0];
	for (i = 1; i < 10; i++) {
		if (a[i] > max) {
			max = a[i];
		}
		if(a[i]<min){
			min = a[i];
		}
	}

	printf("max:%d\nmin:%d\nsum:%d\navg:%f", max, min, sum, sum*1.0/num);


	return 0;
}
*/


/*
//偶数个数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int a[10];
	int i, num = 0;
	printf("请输入10个数\n");
	for (i = 0; i < 10; i++) {

		scanf("%d", &a[i]);

		if (a[i] % 2 == 0) {
			num++;
		}
	}
    printf("偶数为%d个\n", num);

	return 0;
}
*/

/*
//冒泡排序法
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(){
	int a[10];
	int i, j, t;
	printf("请输入10个数组元素\n");
	for (i = 0; i < 10; i++) {
		scanf("%d", &a[i]);
	}
	for(i=1;i<10;i++){
		for (j = 0; j < 9; j++) {
			if (a[j] < a[j + 1]) {
				t = a[j + 1];
				a[j + 1] = a[j];
				a[j] = t;
			}
		}
	}	
     printf("由大到小排好的顺序是：");
	 for (i = 0; i < 10; i++) {
		 printf("%d ", a[i]);
	 }
	return 0;
}
*/


/*
//把一个整数n按大小顺序插入已经排好的序的数组中
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int a[10];
	int i, j, t;
	int n,s;
	printf("请输入10个数组元素\n");
	for (i = 0; i < 10; i++) {
		scanf("%d", &a[i]);
	}
	for (i = 1; i < 10; i++) {
		for (j = 0; j < 9; j++) {
			if (a[j] < a[j + 1]) {
				t = a[j + 1];
				a[j + 1] = a[j];
				a[j] = t;
			}
		}
	}
	printf("由大到小排好的顺序是：");
	for (i = 0; i < 10; i++) {
		printf("%d ", a[i]);
	}
	printf("请输入一个需要插入的数：\n");
	scanf("%d", &n);
	for (i = 0; i < 10; i++) {
		if (n > a[i]) {
			for (s = 9; s >= i; s--) {
				a[s + 1] = a[s];
				break;
			}
		}
	}
		a[i] = n;
		for (i = 0; i <11; i++) {
			printf("%d ", a[i]);
		}
	

	return 0;
}
*/

/*
//辗转相除法 求最大公约数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int m, n, t;
	printf("输入m，n两个两数的值\n");
	scanf("%d %d", &m, &n);
	while (m % n) {            //非0执行循环      为0时跳出循环
		t = m % n;
		m = n;
		n = t;
	}
	printf("最大公约数是:%d\n", n);

	return 0;
}
*/


/*
//乘法表
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i, j;
	printf("乘法表:\n");
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= i; j++) {
			if (i <= 4 && j == 3) {
				printf("%5d*%d=%d", j, i, j * i);
			}
			else {
				printf("%4d*%d=%d", j, i,j * i);
			}
		}
		printf("\n");
	}

	return 0;
}
*/


/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<Windows.h>
#include<string.h>

int main() {
	char arr1[] = "---------------------";
	char arr2[] = "#####################";
	int left = 0;
	int right = strlen(arr1) - 1;

	while (left <= right) {
		arr2[left] = arr1[left];
		arr2[right] = arr1[right];
		printf("%s\n", arr2);
		Sleep(700);//睡眠 (1000)=1秒
	//	system("cls");//清空屏幕
		left++;
		right--;
	}

	return 0;
}
*/

/*
//二分法查找
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
	int k = 0;
	printf("input:\n");
	scanf("%d", &k);
	int sz = sizeof(arr) / sizeof(arr[0]);
	int left = 0;
	int right = sz - 1;
	while (left <= right)
	{
		int mid = (left + right) / 2;
		if (arr[mid] < k)
		{
			left = mid + 1;
		}
		else if (arr[mid] > k)
		{
			right = mid - 1;
		}
		else
		{
			printf("找到了，下标是：%d\n", mid);
			break;
		}
	}
	if (left > right)
	{
		printf("找不到了\n");
	}

	return 0;
}
*/

/*
//穷举法 百钱百鸡
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int x, y, z;
	for (x = 0; x <= 20; x++)
	{
		for (y = 0; y <= 33; y++)
		{
			z = 100 - x - y;

				if ((5 * x + 3 * y + z / 3.0 == 100) && (x + y + z == 100))
				{
					printf("x=%2d,y=%2d,z=%2d\n", x, y, z);
				}

		}
	}


	return 0;
}
*/


/*
//圆的面积
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define pi 3.14
float fun1(float r)
{
	float s = 0;
	s = pi * r * r;
	return s;
}
int main()
{
	printf("input r:\n");
	float r;
	scanf("%f", &r);
	float area = fun1(r);

	printf("area=%.2f", area);
	return 0;
}
*/


/*
//关机
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
	char input[20] = { 0 };
	system("shutdown -s -t 60");
	while (1)
	{
		printf("请注意，你的电脑会在1分钟内关机，如果输入：我是个猪头，吕东芮天下无敌宇宙最帅  ,就可以取消关机\n");
		scanf("%s", input);

		if (strcmp(input, "我是个猪头，吕东芮天下无敌宇宙最帅") == 0)
		{
			system("shutdown -a");
			break;
		}
	}

	return 0;
}
*/


/*
//cmd
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() 
{
	while(1)
	{
		system("start cmd");
	}

	return 0;
}
*/


/*
//圣诞树
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<windows.h>
#include<time.h>

void color(const unsigned short textColor);
void goto_xy(int x, int y);
void tree(int height, int colorOfLeaves);
void snow(int n);

/*根据参数改变字体颜色*/
/*
void color(const unsigned short textColor)
{
	if (textColor >= 0 && textColor <= 15) {
		//参数在0-15的范围颜色
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), textColor);
	}
	else {
		//默认的字体颜色是白色
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
	}
}
/*定位光标位置到指定坐标*/
/*
void goto_xy(int x, int y) {
	HANDLE hout;
	hout = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD pos = { x,y };
	SetConsoleCursorPosition(hout, pos);
}
/*画圣诞树*/
/*
void tree(int height, int colorOfLeaves) {
	//画五角星
	if (colorOfLeaves == 10) {
		color(3);
	}
	else {
		color(11);
	}
	goto_xy(24, 3);
	printf("%c%c\n", 161, 239);//GBK中五角星对应的编码为A1EF，换成十进制就是161 239
	//画叶子
	color(colorOfLeaves);
	for (int i = 1; i < height; i++) {
		if (colorOfLeaves == 14) {
			Sleep(60);
		}
		goto_xy(25 - i - 1, i + 3);
		for (int j = 2 * i + 2; j > 0; j--) {
			printf("*");
		}
		printf("\n");
	}
	//画树干
	goto_xy(25 - 1, height + 3);
	color(4);
	printf("||");
	printf("\n");
}
/*绘制雪景*/
/*
void snow(int n) {
	srand(time(0));
	for (int i = 0; i < n; i++) {
		int x = rand() % 50;
		int y = rand() % 15;
		goto_xy(x, y);
		color(7);
		if (i < n - 5) {
			printf("·");
		}
		else {
			printf("*");
		}

	}
}
int main() {
	system("title 圣诞快乐!");
	system("mode con cols=50 lines=15");//设置窗口大小

	while (1) {
		snow(30);
		tree(10, 10);
		Sleep(1000);//延迟1000毫秒
		tree(10, 14);
		Sleep(1000);//延迟1000毫秒
		system("cls");//清屏
	}
	return 0;
}
*/

/*
//求阶乘
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int fac(int n)
{
	int s=1,i;
	if (n == 1 || n == 0)
	{
		s == 1;
	}
	else if (n < 0)
	{
		printf("error\n");
	}
	else if(n>1)
	{ 
	for (i=1; i<=n; i++)
	{
		s *= i;
	}	
	}	
	return s;
	   
}
	int main()
	{		
		printf("input n:\n");
        int a;
		scanf("%d", &a);
		int result = fac(a);
		printf("%d", result);

		return 0;
	}
*/


/*
//四则运算
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
	int add(int a,int b)
	{
		return a + b;
	}
	int sub(int a,int b)
	{
		return a - b;
	}
	int mul(int a,int b)
	{
		return a * b;
	}
	double divi(double a,double b)
	{
		return a / b;
	}

	int main()
	{
		int x, y;
        char ch=0;
		printf("input a_b:\n");
		scanf("%d %c %d", &x,&ch,&y);		
		int sum = 0,diff=0,pro=0;
		double mer = 0;
       	
		switch (ch)
		{
		case'+':
		     sum = add(x, y);
			printf("a+b=%d\n", sum);
			break;
		case'-':
			 diff = sub(x, y);
			printf("a-b=%d\n", diff);
			break;
		case'*':
		     pro = mul(x, y);
			printf("a*b=%d\n", pro);
			break;
		case'/':
		     mer = divi(x, y);
			printf("a-b=%lf\n", mer);
			break;
		}

		return 0;
	}
	*/

/*
//函数递归 求k!
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int fun(int k)
{
	int s = 1;
	if (k == 0 || k == 1)
	{
		return 1;
	}
	else if (k < 0)
	{
		printf("error\n");
	}
	else 
	{
		s = k * fun(k - 1);
	}
	return s;
}
int main()
{
	int m=0, n;
	printf("input k:\n");
	scanf("%d", &n); 
	m = fun(n);
	printf("k!=%d\n", m);

	return 0;
}
*/

/*
//求n所有因子之积
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int fun(int n)
{
	int i, pro = 1;
	for (i = 1; i <= n; i++)
	{
		if (n % i == 0)
		{
			pro *= i;
		}
	}
	return pro;
}
int main()
{
	int m, s ;
	printf("input n: \n");
	scanf("%d", &m);
	s = fun(m);
	printf("pro=%d\n", s);

	return 0;
}
*/


/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int fun()
{
	int a[10];
	int i,k=500,sum=0;
	for (i = 0; i < 10; k--)
	{
		if (k % 3 == 0 || k % 5 == 0)
		{
			a[i] = k;
			printf("%d\t", a[i]);
			sum += a[i];
			i++;
		}
	}
	return sum;
}
int main()
{
	int m = 0;
	m = fun();
	printf("\n%d", m);

	return 0;
}
*/

/*
//100以内能被5整除且不能被3整除的奇数
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n=100;
	int i;
	for(i=0;i<=n;i++)
	{  
		if (i%2==1)
		{ 
		if (i % 5 == 0 && i % 3 != 0)
		{
			printf("%d\n", i);
	    }
    }    
	}

	return 0;
}
*/

/*
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int i, j, n;
	printf("乘法表:\n");
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= i; j++) {
			
				printf("%d*%d=%d ", j, i, j * i);
			}
			
		printf("\n");
	}

	return 0;
}
*/